import base from '@/api/baseurl';
import request from '@/utils/request'


/**
 * 增加首节点获取节点编号
 * @param {*} query 
 * @returns 
 */
export function addp_code(query) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/addp_code',
    method: 'get',
    params: query
  })
}


/**
 * 增加子节点获取节点编号
 * @param {*} query  parent_code
 * @returns 
 */
 export function addp_code_zi(query) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/addp_code_zi',
    method: 'get',
    params: query
  })
}


/**
 * 遍历权限菜单
 * @param {*} query 
 * @returns 
 */
export function menulist(query) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/menulist',
    method: 'get',
    params: query
  })
}

/**
 * 菜单列表
 * @param {*} query 
 * @returns 
 */
export function findMenu(query) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/findMenu',
    method: 'get',
    params: query
  })
}

/**
 * 更新菜单
 * @param {*} data 
 * @returns 
 */
export function updateMenu(data) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/updateMenu',
    method: 'post',
    data
  })
}

/**
 * 删除菜单
 * @param {*} query 
 * @returns 
 */
export function deleteMenu(query) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/deleteMenu',
    method: 'get',
    params: query
  })
}

/**
 * 添加菜单
 * @param {*} data 
 * @returns 
 */
export function addMenu(data) {
  return request({
    baseURL: base.appBaseApi,
    url: '/menu/addMenu',
    method: 'post',
    data
  })
}

